﻿using System.ComponentModel;
using System.Data.Linq.Mapping;

namespace DBHelper.DB
{
    [Table]
    public class CustomSetTable:INotifyPropertyChanged,INotifyPropertyChanging
    {

        private int customid;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int CustomID
        {
            get { return customid; }
            set
            {
                if (customid != value)
                {
                    NotifyPropertyChanging("CustomID");
                    customid = value;
                    NotifyPropertyChanged("CustomID");
                }
            }
        }

        private string customdata;

        [Column]
        public string CustomData
        {
            get { return customdata; }
            set
            {
                if (customdata != value)
                {
                    NotifyPropertyChanging("CustomData");
                    customdata = value;
                    NotifyPropertyChanged("CustomData");
                }
            }
        }

        private string customname;

        [Column]
        public string CustomName
        {
            get { return customname; }
            set
            {
                if (customname != value)
                {
                    NotifyPropertyChanging("CustomName");
                    customname = value;
                    NotifyPropertyChanged("CustomName");
                }
            }
        }

        private string customstyle;

        [Column]
        public string CustomStyle
        {
            get { return customstyle; }
            set
            {
                if (customstyle != value)
                {
                    NotifyPropertyChanging("CustomStyle");
                    customstyle = value;
                    NotifyPropertyChanged("CustomStyle");
                }
            }
        }

        #region INotifyPropertyChanged 成员

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion

        #region INotifyPropertyChanging 成员

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        #endregion
    }
}
